package com.hsylient.javase.chapter04.demo02;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * 泛型不会影响原本的数据类型
 */
@Slf4j
@SuppressWarnings("all")
public class GenericType {

    @Test
    public void testGeneric() {
        List<String> stringArrayList = new ArrayList<>();
        List<Integer> integerArrayList = new ArrayList<>();

        Class classStringArrayList = stringArrayList.getClass();
        Class classIntegerArrayList = integerArrayList.getClass();

        log.info("[测试泛型是否会影响原本的数据类型] {}", classStringArrayList.equals(classIntegerArrayList) ? "不会" : "会");

    }
}
